<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		#baidu:hover{
			color: red;
		}

	</style>
</head>
<body>
	<input type="button" value="修改p元素的内容" id="btn">
	<div id="first">
		<p>北京你好</p>
		<p>北京你好</p>
		<p>北京你好</p>
		<p>北京你好</p>
		<p>北京你好</p>
	</div>
	
	<hr>
	<div>
		<p>北京你好</p>
		<p>北京你好</p> 
		<p>北京你好</p>
	</div>
	<input type="button" value="点击按钮修改a标签的地址和热点文字" id="btn2">
	<a href="https://www.baidu.com/" id="baidu">百度</a>

	<script>
		var btn = document.getElementById('btn');
		var btn2 = document.getElementById("btn2");
		var Baidu = document.getElementById("baidu");
		var first = document.getElementById('first')
		// var pList = document.getElementsByTagName("p");
		var pList = first.children;
		// console.log(pList)




		btn.onclick = function(){
			for(var i=0;i<pList.length;i++){
				// console.log(pList[i])
				pList[i].innerHTML = "<h3>你好北京是</h3>"
			}

		}

		btn2.onclick = function(){
			Baidu.href = "https://www.jd.com";
			Baidu.innerText = "京东"
		}


	</script>
</body>
</html>